//
//  KSDUtilsMacros.h
//  KSuodun
//
//  Created by DwZeng on 2022/7/18.
//

#ifndef KSDUtilsMacros_h
#define KSDUtilsMacros_h

//屏幕宽度
#define SCREEN_WIDTH   [[UIScreen mainScreen] bounds].size.width
//屏幕高度
#define SCREEN_HEIGHT  [[UIScreen mainScreen] bounds].size.height
#define SCREEN_RECT    CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)
//屏幕比例
#define ScreenScale SCREEN_WIDTH/375.0
//根据当前屏幕宽度得到宽度
#define pixw(p) (SCREEN_WIDTH/375.0)*p
#define pixh(p) (SCREEN_HEIGHT/667.0)*p
#define navigationHeight (statusHeight + 44)
#define statusHeight [UIApplication sharedApplication].statusBarFrame.size.height
//frame
#define MakeRect(x,y,width,height) CGRectMake(x, y, width, height)


#define is_iphone5s (SCREEN_WIDTH == 320)

/************判断设备******************/
// iphone4, iphone4s系列
#define IPHONE_4   ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)
// iphone5, iphone5c，iphone5s系列
#define IPHONE_5     ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136),[[UIScreen mainScreen] currentMode].size) : NO)
// iphone6, iphone6s系列
#define IPHONE_6     ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [UIScreen mainScreen].currentMode.size) : NO)
// iphone6 plus, iphone6s plus系列
#define IPHONE_6P    ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? (CGSizeEqualToSize(CGSizeMake(1125, 2001), [UIScreen mainScreen].currentMode.size) || CGSizeEqualToSize(CGSizeMake(1242, 2208), [UIScreen mainScreen].currentMode.size)) : NO)


#define VPUserDefaults [NSUserDefaults standardUserDefaults]

//keyWindow
#define FLKeyWindow [UIApplication sharedApplication].keyWindow

#define tabBarHidden [YLCAPPManager shareManager].tabBar.tabBarView.hidden

// 判断是否是x系列手机
#define is_iphoneX \
({BOOL isPhoneX = NO;\
if (@available(iOS 11.0, *)) {\
isPhoneX = [[UIApplication sharedApplication] delegate].window.safeAreaInsets.bottom > 0.0;\
}\
(isPhoneX);})

#define tabBarHeight (is_iphoneX ? (34+49) : 49)

#define bottomSafeAreaHeight (is_iphoneX ? 34 : 0)
//是否是开发环境
#define isDevelop [[VPUserDefaults objectForKey:isDevelopment] boolValue]

#define RunAsyncOnMain(block) dispatch_async(dispatch_get_main_queue(), block)

#ifdef DEBUG // 调试状态, 打开LOG功能
#define LOG(...) NSLog(__VA_ARGS__)
#else // 发布状态, 关闭LOG功能
#define LOG(...)
#endif

#endif /* KSDUtilsMacros_h */
